package com.system.Mapper;

import com.system.Entity.Role;
import com.system.Entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Mapper
public interface UserMapper {


    Integer funUsername(String username);

    // 检查邮箱是否存在

    Integer funEmail(String email);


    Integer funPhone(String phone);

    void InsertUserMsg(User user);

    void insertUser_Role(String userId);

    User SerachUsername(String username);

    User SerachPhone(String phone);

    User SerachEmail(String email);

    int getRole(String userId);

    void updateAvatarByUserName(@Param("userName")String userName, @Param("avatar")String avatar);

    void updateUserProfile(User user);

    void updatePhoneByUserName(String userName, String phone);

    void updateEmailByUserName(String userName, String email);

    void updatePassword(String userName, String encryptedNewPWD);


    void updateLoginTime(String loginTimestamp, String userName);

    List<User> getUserList(@Param("username") String userName);

    List<Role> getRoleList();

    void updateStatusByUserId(@Param("userid") String userId,@Param("status")Integer status);

    void insertUser_Role_A(@Param("userId")String userId, @Param("roleId")Integer roleId);


    void updateUser_A_status(@Param("userId")String userId,
                             @Param("status")Integer status,
                             @Param("updateUser") String updateUser,
                             @Param("updateTime") LocalDateTime updateTime);

    void updateUser_A_role(@Param("userId")String userId,
                           @Param("roleId")Integer roleId,
                           @Param("updateUser") String updateUser,
                           @Param("updateTime") LocalDateTime updateTime);

    void deleteUser(@Param("userId") String userId);

    void deleteUser_role(@Param("userId") String userId);
}
